/*
 * PartComboBoxModel.java
 *
 */
package org.lpp;

import javax.swing.DefaultComboBoxModel;

/**
 * @author rhisld
 */
public class PartComboBoxModel extends DefaultComboBoxModel {
    /**
     * Determines if a de-serialized file is compatible with this class.
     *
     * Maintainers must change this value if and only if the new version
     * of this class is not compatible with old versions. See Sun docs
     * for <a href=http://java.sun.com/products/jdk/1.1/docs/guide
     * /serialization/spec/version.doc.html> details. </a>
     */
    private static final long serialVersionUID = 7526471155622776199L;
    
    /** Creates a new instance of PartComboBoxModel */
    public PartComboBoxModel() {
        super();
    }
    
    public PartListEntry getObjectByPartId(int partId) {
        PartListEntry entryForId = null;
        for (int i = 0; i < getSize(); i++) {
            PartListEntry entry = (PartListEntry)getElementAt(i);
            if (entry.getId() == partId) {
                entryForId = entry;
            }
        }
        return entryForId;
    }
}
